<style>
#load{
    width:100%;
    height:100%;
    position:fixed;
    z-index:9999;
    background:url("images/loading_bar.gif") no-repeat center center #fff;
}
</style>
<script>
document.onreadystatechange = function (){
	var path = window.location.href;
    path = path.replace(/\/$/, "");
    path = decodeURIComponent(path);
	var pageUrl		=	path;
	sessionStorage.setItem( 'pageUrl', JSON.stringify(pageUrl) );
  
  var state = document.readyState
  if (state == 'interactive') {
       document.getElementById('contents').style.visibility="hidden";
  } else if (state == 'complete') {
      setTimeout(function(){
	   if(typeof sessionStorage["shop_user_id"]!='undefined'){
			document.getElementById('interactive');
			document.getElementById('load').style.visibility="hidden";
			document.getElementById('contents').style.visibility="visible";
		 }else{
			window.location="index.html";
		 }
      },300);
  }
}
</script>
<script src="js/chart.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/webserviceurl.js"></script>
<script src="js/validations.js"></script>
<script src="js/commonfunctions.js"></script>
<script src="js/text.js"></script>
<link href="css/style.css" rel="stylesheet">
<link href="css/default.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">
<script>
	google.load('visualization', '1', {packages: ['corechart']});
</script>
<script>
$(function() {
$('#sidemenu').load('side-menu.html');
$('#header').load('header.html');
$('#footer').load('footer.html');
var shop_id = JSON.parse(sessionStorage["shop_user_id"]);
	$('#visualization').html('Please wait loading....');
	$.ajax({
		type		:	'POST',
		url			:  	webServiceUrl+'shop-orders',
		dataType	: 	"json",			
		data	    : 	{shop_id:shop_id},			
		success: function(data){
			if( data.totOrders!=0 || data.totrenewalOrders!=0 || data.totSentorders!=0 || data.totConfirmedOrders!=0 || data.totDeliveredOrders!=0 || data.totunPaidOrders!=0 || data.totPaidOrders!=0){
					var json='[["shop", "reports"],';					
					var finall='';
					finall=finall+'["TotalOrders",'+data.totOrders+']'+','+'["TotRenewalOrders",'+data.totrenewalOrders+']'+','+'["SentpriceToAdmin",'+data.totSentorders+']'+','+'["ConfirmedOrders",'+data.totConfirmedOrders+']'+','+'["DeliveredOrders",'+data.totDeliveredOrders+']'+','+'["DiscountsUnpaidToAdmin",'+data.totunPaidOrders+']'+','+'["DiscountsPaidToAdmin",'+data.totPaidOrders+']';				
					finall=finall.replace(/,\s*$/, ",");
					json+=finall+']';
					var data = google.visualization.arrayToDataTable($.parseJSON(json));					 
					new google.visualization.PieChart(document.getElementById('visualization')).
					draw(data, {title:"Shop Orders Reports"});														
				}else{						
					$('#visualization').html('No reports....');
				}	
		}				
	});
});
</script>
<div id="load"></div>
<div id="contents">
  <div id="header"></div>
    <div class="container-fluid">
      <div class="row-fluid container_bg">
      <div id="sidemenu"></div>
        <div class="span9">
			<div class="container_title" style="position:relative;">
				<div class=""><h1>Reports</h1></div>
				<a href='reports.html'>Complaints And Reviews</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='shop-orders-report.html'>Shop Orders Report</a>
				<div class="container_form_top">
					<div class="row">
						<div id="visualization" style="width: 100%; height: 400px;"></div>						
					<div class="row">
						<div id="visualization1" style="width: 100%; height: 400px;"></div>
					</div>
				</div>				
			</div>
        </div>
      </div>
    </div>
<div id="footer"></div>
</div>
 
